import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '编号',
    align: "center",
    dataIndex: 'code'
  },
  {
    title: '名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '资源属性',
    align: "center",
    dataIndex: 'resourceAttribute',
    customRender: ({ text }) => {
      return render.renderDict(text, 'resource_attribute')
    },
  },
  {
    title: '归属部门',
    align: "center",
    dataIndex: 'belongDepartmentName'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "名称",
    field: "name",
    component: 'Input',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '资源属性',
    field: 'resourceAttribute',
    component: 'Input',
    slot: 'resourceAttributeSlot',
    colProps: {
      span: 6,
    },
  },
  {
    label: '分组编号',
    field: 'code',
    component: 'Input',
    colProps: {
      span: 6,
    },
  },
  {
    label: '归属部门ID',
    field: 'belongDepartmentName',
    component: 'JSelectDept',
    show: false,
    componentProps: ({}) => {
      return {
        multiple: false,
        showButton: false,
        checkable: false
      }
    },
    colProps: {
      span: 0,
    },
  },

  {
    label: '归属部门名称',
    field: 'belongDepartmentId',
    component: 'JSelectDept',
    componentProps: ({}) => {
      return {
        multiple: false,
        showButton: false,
        checkable: false
      }
    },
    colProps: {
      span: 12,
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
    colProps: {
      span: 24,
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];
//子表单数据
//子表表格配置
export const busMiscellaneousStorageItemColumns: JVxeColumn[] = [
  {
    title: '资源编号',
    key: 'associationCode',
    type: JVxeTypes.slot,
    width: "150px",
    placeholder: '请输入${title}',
    defaultValue: '',
    slotName: 'associationCodeSlot'
  },
  {
    title: '资源名称',
    key: 'associationName',
    type: JVxeTypes.input,
    width: "180px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '优先顺序',
    key: 'priority',
    type: JVxeTypes.input,
    placeholder: '请输入${title}',
    width: "180px",
    defaultValue: '',
  },
  {
    title: '加工工艺ID',
    key: 'processManagementId',
    type: JVxeTypes.hidden,
  },
  {
    title: '加工工艺',
    key: 'useDepartmentName',
    type: JVxeTypes.input,
    width: "180px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '加工班组ID',
    key: 'useDepartmentId',
    type: JVxeTypes.hidden,
  },
  {
    title: '加工班组',
    key: 'workshopCode',
    type: JVxeTypes.input,
    width: "180px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '是否专用',
    key: 'specialPurpose',
    type: JVxeTypes.select,
    placeholder: '请输入${title}',
    defaultValue: 1,
    width: "180px",
    options: [{ value: 0, label: '否' }, { value: 1, label: '是' }]
  },
  {
    title: '工作时长',
    key: 'workHours',
    type: JVxeTypes.input,
    placeholder: '请输入${title}',
    width: "180px",
    defaultValue: '',
  },

]


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
